defmodule PangoPoolLib do
	@moduledoc false


	def children(pool_name, worker, pool_size, pool_max_overflow, args) do
		pool_options = [
			name: {:local, pool_name},
			worker_module: worker,
			size: pool_size,
			max_overflow: pool_max_overflow
		]
		[
			:poolboy.child_spec(pool_name, pool_options, args)
		]
	end

	def cast(pool, msg) do
		:poolboy.transaction(
			pool,
			fn (worker) ->
				GenServer.cast(worker, msg)
			end,
			5000
		)
	end


end
